package com.wzqj.agent.common;

import java.util.List;

/** 
 * 分页
 * @author tanwei 
 * @version 创建时间：2014年6月19日 下午8:16:52 
 * 类说明 
 * @param <T>
 */
public class Page<T> {
	
	public static int defaultPageSize = 10;//默认每页显示数量
	
	/**
	 * 页面大小
	 */
	private int pageSize;
	
	/**
	 * 页号
	 */
	private int pageNo;
	
	/**
	 * 总页数
	 */
	private int pageCount;
	
	/**
	 * 记录总数
	 */
	private int total;
	
	private List<T> list;
	
	public Page() {

	}
	
	public Page(int total, int pageNo, List<T> list) {
		this.pageSize = defaultPageSize;
		this.pageNo = pageNo;
		this.list = list;
		this.total = total;
		this.pageCount = this.total/this.pageSize;
		if(this.total%this.pageSize != 0) {
			this.pageCount++;
		}
	}
	
	public int getStart() {
		return (pageNo-1)*pageSize + 1;
	}
	
	public int getEnd() {
		return pageNo*pageSize;
	}

	public int getPageNo() {
		return pageNo;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageCount() {
		pageCount = total/pageSize;
		if(total%pageSize != 0) {
			pageCount++;
		}
		return pageCount;
	}

	public int getRecordSize() {
		return total;
	}

	public void setRecordSize(int size) {
		this.total = size;
	}

	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

}
